[remote-playback] Editorial improvements to text and code (#41852)
diff --git a/remote-playback/README.md b/remote-playback/README.md index b934227..da9bbc3 100644 --- a/remote-playback/README.md +++ b/remote-playback/README.md
@@ -8,7 +8,13 @@ ## Hardware/network dependency -The Remote Playback API requires to communicate with a device over the network. -Some behavior would require a real devices to be implemented. In order to keep -these tests automated, only behaviors that can be run without user gesture or -specific configurations are available here. +The Remote Playback API requires communication with a device over the network. +Tests that end in `-manual.html` require a compatible device available on the +local area network to run the tests; these tests must be run manually. + +Known browser/device combinations that can be used to run manual tests: + +| Browser | Device | +| ------- | ------ | +| Chrome for Android | [Chromecast](https://store.google.com/product/chromecast_google_tv?pli=1&hl=en-US) | +| Safari | Apple TV |
diff --git a/remote-playback/cancel-watch-availability.html b/remote-playback/cancel-watch-availability.html index a3fc967..41cad7c 100644 --- a/remote-playback/cancel-watch-availability.html +++ b/remote-playback/cancel-watch-availability.html
@@ -1,23 +1,23 @@ <!DOCTYPE html> <html> - <title>Tests various ways to call cancelWatchAvailability()</title> + <title>Tests cancelWatchAvailability()</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/common/media.js"></script> <script> - async_test((t) => { + async_test(t => { let v = document.createElement("video"); v.src = getVideoURI("/media/movie_5"); v.remote .watchAvailability(() => {}) .then( - t.step_func((id) => { + t.step_func(id => { v.remote.cancelWatchAvailability(id).then( t.step_func(() => { v.remote.cancelWatchAvailability(id).then( t.unreached_func(), - t.step_func_done((e) => { + t.step_func_done(e => { assert_equals(e.name, "NotFoundError"); }) ); @@ -27,9 +27,9 @@ }), t.unreached_func() ); - }, "Test that calling cancelWatchAvailability() with an id does remove the callback."); + }, "Test that calling cancelWatchAvailability() with an id does remove the callback, and calling cancelWatchAvailability with a removed id throws NotFoundError."); - async_test((t) => { + async_test(t => { let v = document.createElement("video"); v.src = getVideoURI("/media/movie_5"); @@ -37,16 +37,16 @@ v.remote.watchAvailability(() => {}), v.remote.watchAvailability(() => {}), ]).then( - t.step_func((ids) => + t.step_func(ids => v.remote.cancelWatchAvailability().then( t.step_func(() => v.remote.cancelWatchAvailability(ids[0]).then( t.unreached_func(), - t.step_func((e) => { + t.step_func(e => { assert_equals(e.name, "NotFoundError"); v.remote.cancelWatchAvailability(ids[1]).then( t.unreached_func(), - t.step_func_done((e) => + t.step_func_done(e => assert_equals(e.name, "NotFoundError") ) ); @@ -58,6 +58,6 @@ ), t.unreached_func() ); - }, "Test that calling cancelWatchAvailability() without an id removes all the callbacks."); + }, "Test that calling cancelWatchAvailability() without an id removes all the callbacks, and calling cancelWatchAvailability() with a removed id throws NotFoundError."); </script> </html> diff --git a/remote-playback/disable-remote-playback-cancel-watch-availability-throws.html b/remote-playback/disable-remote-playback-cancel-watch-availability-throws.html index 4783f64..7b93f8e 100644 --- a/remote-playback/disable-remote-playback-cancel-watch-availability-throws.html +++ b/remote-playback/disable-remote-playback-cancel-watch-availability-throws.html
@@ -1,34 +1,33 @@ <!DOCTYPE html> <html> <title> - Test that calling cancelWatchAvailability() when disableRemotePlayback - attribute is set throws an exception + Test that calling cancelWatchAvailability() when disableRemotePlayback attribute is set throws InvalidStateError </title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/common/media.js"></script> <script> - async_test((t) => { + async_test(t => { let v = document.createElement("video"); v.src = getVideoURI("/media/movie_5"); v.remote .watchAvailability(() => {}) - .then((id) => { + .then(id => { v.disableRemotePlayback = true; v.remote.cancelWatchAvailability(id).then( t.unreached_func(), - t.step_func((e) => { + t.step_func(e => { assert_equals(e.name, "InvalidStateError"); v.remote.cancelWatchAvailability().then( t.unreached_func(), - t.step_func_done((e) => { + t.step_func_done(e => { assert_equals(e.name, "InvalidStateError"); }) ); }) ); }, t.unreached_func()); - }, "Test that calling cancelWatchAvailability() when disableRemotePlayback attribute is set throws an exception."); + }, "Test that calling cancelWatchAvailability() when disableRemotePlayback attribute is set throws InvalidStateError."); </script> </html> diff --git a/remote-playback/disable-remote-playback-prompt-throws.html b/remote-playback/disable-remote-playback-prompt-throws.html index cd44045..b47e30e 100644 --- a/remote-playback/disable-remote-playback-prompt-throws.html +++ b/remote-playback/disable-remote-playback-prompt-throws.html
@@ -1,14 +1,13 @@ <!DOCTYPE html> <html> <title> - Test that calling prompt() when disableRemotePlayback attribute is set - throws an exception + Test that calling prompt() when disableRemotePlayback attribute is set throws an exception </title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/common/media.js"></script> <script> - promise_test((t) => { + promise_test(t => { let v = document.createElement("video"); v.src = getVideoURI("/media/movie_5"); v.disableRemotePlayback = true; diff --git a/remote-playback/disable-remote-playback-watch-availability-throws.html b/remote-playback/disable-remote-playback-watch-availability-throws.html index e594a49..7496b86 100644 --- a/remote-playback/disable-remote-playback-watch-availability-throws.html +++ b/remote-playback/disable-remote-playback-watch-availability-throws.html
@@ -1,14 +1,13 @@ <!DOCTYPE html> <html> <title> - Test that calling watchAvailability() when disableRemotePlayback attribute - is set throws an exception + Test that calling watchAvailability() when disableRemotePlayback attribute is set throws an exception </title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/common/media.js"></script> <script> - promise_test((t) => { + promise_test(t => { let v = document.createElement("video"); v.src = getVideoURI("/media/movie_5"); v.disableRemotePlayback = true; diff --git a/remote-playback/event-handlers-manual.html b/remote-playback/event-handlers-manual.html index b7c32db..b57a24b 100644 --- a/remote-playback/event-handlers-manual.html +++ b/remote-playback/event-handlers-manual.html
@@ -1,6 +1,8 @@ <!DOCTYPE html> <html> - <title>Test that all event handlers are called.</title> + <title> + Test that all event handlers are called when a remote playback device is connected + </title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/common/media.js"></script> @@ -30,7 +32,7 @@ let v = document.createElement("video"); v.src = getVideoURI("/media/movie_5"); - async_test((t) => { + async_test(t => { let onConnectingCalled = false; let onConnectCalled = false; let onDisconnectCalled = false; @@ -55,6 +57,6 @@ assert_true(onDisconnectCalled, "ondisconnect was called"); }) ); - }, "Test that all event handlers are called."); + }, "Test that all event handlers are called when a remote playback device is connected."); </script> </html> diff --git a/remote-playback/prepare-device.js b/remote-playback/prepare-device.js index 825768f..a12dbaf 100644 --- a/remote-playback/prepare-device.js +++ b/remote-playback/prepare-device.js
@@ -1,10 +1,8 @@ -var startButton = document.getElementById("start-button"); -startButton.onclick = function () { +document.getElementById("start-button").onclick = () => { document.getElementById("prep").style.display = "none"; document.getElementById("pick-device").style.display = "block"; }; -var promptPrepButton = document.getElementById("prompt-button-prep"); -promptPrepButton.onclick = function () { +document.getElementById("prompt-button-prep").onclick = () => { v.remote .prompt() .then(() => {}) diff --git a/remote-playback/prompt-and-cancel-selection-manual.html b/remote-playback/prompt-and-cancel-selection-manual.html index eb93df8..89a7373 100644 --- a/remote-playback/prompt-and-cancel-selection-manual.html +++ b/remote-playback/prompt-and-cancel-selection-manual.html
@@ -1,7 +1,7 @@ <!DOCTYPE html> <html> <title> - Test that promise is rejected when user cancels device selection. + Test that the Promise returned by prompt() is rejected when user cancels device selection </title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> @@ -17,7 +17,7 @@ <button id="prompt-button">Pick device</button> </body> <script> - async_test((t) => { + async_test(t => { let v = document.createElement("video"); v.src = getVideoURI("/media/movie_5"); @@ -27,11 +27,11 @@ .prompt() .then(t.unreached_func()) .catch( - t.step_func_done((error) => + t.step_func_done(error => assert_equals(error.name, "NotAllowedError") ) ) ); - }, "Test that promise is rejected when user cancels device selection."); + }, "Test that the Promise returned by prompt() is rejected when user cancels device selection."); </script> </html> diff --git a/remote-playback/prompt-and-select-device-manual.html b/remote-playback/prompt-and-select-device-manual.html index 0038c0f..77973af 100644 --- a/remote-playback/prompt-and-select-device-manual.html +++ b/remote-playback/prompt-and-select-device-manual.html
@@ -1,6 +1,6 @@ <!DOCTYPE html> <html> - <title>Test that promise is resolved when user selects a device.</title> + <title>Test that the Promise returned by prompt() is resolved when user selects a device</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/common/media.js"></script> @@ -26,13 +26,13 @@ let v = document.createElement("video"); v.src = getVideoURI("/media/movie_5"); - async_test((t) => { + async_test(t => { let button = document.getElementById("prompt-button"); button.onclick = t.step_func_done(() => { promise_test(() => { return v.remote.prompt(); }, "Prompt resolves"); }); - }, "Test that promise is resolved when user selects a device."); + }, "Test that the Promise returned by prompt() is resolved when user selects a device."); </script> </html> diff --git a/remote-playback/prompt-and-watch-availability-no-device-manual.html b/remote-playback/prompt-and-watch-availability-no-device-manual.html index 59f6d52..7d69f09 100644 --- a/remote-playback/prompt-and-watch-availability-no-device-manual.html +++ b/remote-playback/prompt-and-watch-availability-no-device-manual.html
@@ -1,8 +1,7 @@ <!DOCTYPE html> <html> <title> - Test that watchAvailability returned false when there is no device for the - user to select. + Test that watchAvailability() runs the callback with false when there is no device for the user to select </title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> @@ -29,12 +28,12 @@ let v = document.createElement("video"); v.src = getVideoURI("/media/movie_5"); - async_test((t) => { + async_test(t => { let deviceAvailable = false; let button = document.getElementById("prompt-button"); button.onclick = function () { v.remote - .watchAvailability(t.step_func((avail) => (deviceAvailable = avail))) + .watchAvailability(t.step_func(avail => (deviceAvailable = avail))) .then( t.step_func(() => { promise_rejects_js(t, NotFoundError, v.remote.prompt()); @@ -43,6 +42,6 @@ t.unreached_func() ); }; - }, "Test that watchAvailability returned false when there is no device for the user to select."); + }, "Test that watchAvailability() runs the callback with false when there is no device for the user to select."); </script> </html> diff --git a/remote-playback/prompt-and-watch-availability-with-device-manual.html b/remote-playback/prompt-and-watch-availability-with-device-manual.html index fff8a38..fa86449 100644 --- a/remote-playback/prompt-and-watch-availability-with-device-manual.html +++ b/remote-playback/prompt-and-watch-availability-with-device-manual.html
@@ -1,7 +1,7 @@ <!DOCTYPE html> <html> <title> - Test that watchAvailability returned true when user selects device. + Test that watchAvailability() runs the callback with true when user selects a device </title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> @@ -28,12 +28,12 @@ let v = document.createElement("video"); v.src = getVideoURI("/media/movie_5"); - async_test((t) => { + async_test(t => { let deviceAvailable = false; let button = document.getElementById("prompt-button"); button.onclick = () => { v.remote - .watchAvailability(t.step_func((avail) => (deviceAvailable = avail))) + .watchAvailability(t.step_func(avail => (deviceAvailable = avail))) .then( t.step_func(() => { v.remote @@ -51,6 +51,6 @@ t.unreached_func() ); }; - }, "Test that watchAvailability returned true when user selects device."); + }, "Test that watchAvailability() runs the callback with true when user selects a device."); </script> </html> diff --git a/remote-playback/remote-video-control-pausing-manual.html b/remote-playback/remote-video-control-pausing-manual.html index 21e8f9f..8dfc19b 100644 --- a/remote-playback/remote-video-control-pausing-manual.html +++ b/remote-playback/remote-video-control-pausing-manual.html
@@ -1,7 +1,7 @@ <!DOCTYPE html> <html> <link rel="stylesheet" href="styles.css" /> - <title>Test that pause() on the local video is reflected on the remote device.</title> + <title>Test that pause() on the local video is reflected on the remote device</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/common/media.js"></script> @@ -36,7 +36,7 @@ <script> let v = document.getElementById("video"); - async_test((t) => { + async_test(t => { let button = document.getElementById("prompt-button"); button.onclick = t.step_func(() => { promise_test(() => { @@ -58,7 +58,7 @@ } }; - let evaluate = (success) => + let evaluate = success => assert_true(success, "Video paused and has correct play position."); document.getElementById("yes").onclick = t.step_func_done(() => @@ -67,6 +67,6 @@ document.getElementById("no").onclick = t.step_func_done(() => evaluate(false) ); - }, "Test if video is playing on remote device."); + }, "Test that pause() on the local video is reflected on the remote device."); </script> </html> diff --git a/remote-playback/remote-video-control-seek-manual.html b/remote-playback/remote-video-control-seek-manual.html index 5dc3266..56156d9 100644 --- a/remote-playback/remote-video-control-seek-manual.html +++ b/remote-playback/remote-video-control-seek-manual.html
@@ -1,7 +1,7 @@ <!DOCTYPE html> <html> <link rel="stylesheet" href="styles.css" /> - <title>Test that seek() on the local video is reflected on the remote device.</title> + <title>Test that seek() on the local video is reflected on the remote device</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/common/media.js"></script> @@ -39,7 +39,7 @@ <script> let v = document.getElementById("video"); - async_test((t) => { + async_test(t => { let button = document.getElementById("prompt-button"); button.onclick = t.step_func(() => { promise_test(() => { @@ -64,7 +64,7 @@ } }; - let evaluate = (success) => + let evaluate = success => assert_true(success, "Video paused and has correct play position."); document.getElementById("yes").onclick = t.step_func_done(() => @@ -73,6 +73,6 @@ document.getElementById("no").onclick = t.step_func_done(() => evaluate(false) ); - }, "Test if video is playing on remote device."); + }, "Test that seek() on the local video is reflected on the remote device."); </script> </html> diff --git a/remote-playback/remote-video-playback-manual.html b/remote-playback/remote-video-playback-manual.html index fb51c48..223a5b4 100644 --- a/remote-playback/remote-video-playback-manual.html +++ b/remote-playback/remote-video-playback-manual.html
@@ -1,6 +1,6 @@ <!DOCTYPE html> <html> - <title>Test if video is playing on remote device.</title> + <title>Test if video is playing on remote device</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/common/media.js"></script> @@ -36,7 +36,7 @@ <script> let v = document.getElementById("video"); - async_test((t) => { + async_test(t => { let button = document.getElementById("prompt-button"); button.onclick = t.step_func(() => { promise_test(() => { @@ -47,7 +47,7 @@ }, "Prompt resolves"); }); - let evaluate = (success) => + let evaluate = success => assert_true(success, "Video paused and has correct play position."); document.getElementById("yes").onclick = t.step_func_done(() => diff --git a/remote-playback/state-attribute-changes-when-selecting-device-manual.html b/remote-playback/state-attribute-changes-when-selecting-device-manual.html index 10a048d..90f51af 100644 --- a/remote-playback/state-attribute-changes-when-selecting-device-manual.html +++ b/remote-playback/state-attribute-changes-when-selecting-device-manual.html
@@ -1,7 +1,7 @@ <!DOCTYPE html> <html> <title> - Test that the remote playback state changes when selecting a device. + Test that the remote playback state changes when selecting a device </title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> @@ -28,7 +28,7 @@ let v = document.createElement("video"); v.src = getVideoURI("/media/movie_5"); - async_test((t) => { + async_test(t => { assert_equals(v.remote.state, "disconnected"); function callback(available) { diff --git a/remote-playback/state-attribute-changes-with-event-handlers-manual.html b/remote-playback/state-attribute-changes-with-event-handlers-manual.html index e0e849a..725613e 100644 --- a/remote-playback/state-attribute-changes-with-event-handlers-manual.html +++ b/remote-playback/state-attribute-changes-with-event-handlers-manual.html
@@ -1,7 +1,7 @@ <!DOCTYPE html> <html> <title> - Test that remote playback state changes when connecting and disconnecting. + Test that remote playback state changes when connecting and disconnecting </title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> @@ -32,7 +32,7 @@ let v = document.createElement("video"); v.src = getVideoURI("/media/movie_5"); - async_test((t) => { + async_test(t => { v.remote.onconnecting = () => assert_equals(v.remote.state, "connecting"); v.remote.onconneced = () => assert_equals(v.remote.state, "connected"); v.remote.ondisconnected = () => diff --git a/remote-playback/watch-availability-callback-parameter.html b/remote-playback/watch-availability-callback-parameter.html index e05507e..fe407a9 100644 --- a/remote-playback/watch-availability-callback-parameter.html +++ b/remote-playback/watch-availability-callback-parameter.html
@@ -2,13 +2,13 @@ <html> <title> Test that the callback is called with boolean parameter when calling - watchAvailability(). + watchAvailability() </title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/common/media.js"></script> <script> - async_test((t) => { + async_test(t => { let v = document.createElement("video"); v.src = getVideoURI("/media/movie_5"); @@ -21,7 +21,7 @@ t.unreached_func() ) .catch( - t.step_func_done((error) => + t.step_func_done(error => assert_equals(error.name, "NotSupportedError") ) ); diff --git a/remote-playback/watch-availability-initial-callback.html b/remote-playback/watch-availability-initial-callback.html index e615b76..b540d83 100644 --- a/remote-playback/watch-availability-initial-callback.html +++ b/remote-playback/watch-availability-initial-callback.html
@@ -1,13 +1,13 @@ <!DOCTYPE html> <html> <title> - Test that the callback is called once watchAvailability() resolves. + Test that the callback is called after the Promise returned by watchAvailability() resolves </title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/common/media.js"></script> <script> - async_test((t) => { + async_test(t => { let v = document.createElement("video"); v.src = getVideoURI("/media/movie_5"); @@ -21,6 +21,6 @@ }), t.unreached_func() ); - }, "Test that the callback is called once watchAvailability() resolves."); + }, "Test that the callback is called after the Promise returned by watchAvailability() resolves."); </script> </html> diff --git a/remote-playback/watch-availability-promise-return-callback-id.html b/remote-playback/watch-availability-promise-return-callback-id.html index 771a36c..c3df0b3 100644 --- a/remote-playback/watch-availability-promise-return-callback-id.html +++ b/remote-playback/watch-availability-promise-return-callback-id.html
@@ -1,25 +1,24 @@ <!DOCTYPE html> <html> <title> - Test that the promise returns the callback id when calling - watchAvailability(). + Test that the Promise returned by watchAvailability() resolves with a numeric callback id </title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/common/media.js"></script> <script> - async_test((t) => { + async_test(t => { let v = document.createElement("video"); v.src = getVideoURI("/media/movie_5"); v.remote .watchAvailability(() => {}) .then( - t.step_func_done((callbackId) => { + t.step_func_done(callbackId => { assert_true(typeof callbackId === "number"); }), t.unreached_func() ); - }, "Test that the promise returns the callback id when calling watchAvailability()."); + }, "Test that the Promise returned by watchAvailability() resolves with a numeric callback id."); </script> </html>